<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Minitest::Runnable - minitest: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-methods_matching">::methods_matching</a>
    <li ><a href="#method-c-run">::run</a>
    <li ><a href="#method-c-run_one_method">::run_one_method</a>
    <li ><a href="#method-c-runnable_methods">::runnable_methods</a>
    <li ><a href="#method-c-runnables">::runnables</a>
    <li ><a href="#method-c-test_order">::test_order</a>
    <li ><a href="#method-i-metadata">#metadata</a>
    <li ><a href="#method-i-metadata-3F">#metadata?</a>
    <li ><a href="#method-i-name">#name</a>
    <li ><a href="#method-i-name-3D">#name=</a>
    <li ><a href="#method-i-passed-3F">#passed?</a>
    <li ><a href="#method-i-result_code">#result_code</a>
    <li ><a href="#method-i-run">#run</a>
    <li ><a href="#method-i-skipped-3F">#skipped?</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Minitest::Runnable">
    <h1 id="class-Minitest::Runnable" class="class">
      class Minitest::Runnable
    </h1>

    <section class="description">
    
<p>Represents anything “runnable”, like <a href="Test.html"><code>Test</code></a>, <a href="Spec.html"><code>Spec</code></a>, <a href="Benchmark.html"><code>Benchmark</code></a>, or whatever you can dream up.</p>

<p>Subclasses of this are automatically registered and available in <a href="Runnable.html#method-c-runnables"><code>Runnable.runnables</code></a>.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">



        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-assertions" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">assertions</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>Number of assertions executed in this run.</p>
              </div>
            </div>
          <div id="attribute-i-failures" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">failures</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>An assertion raised during the run, if any.</p>
              </div>
            </div>
          <div id="attribute-i-metadata" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">metadata</span><span
                class="attribute-access-type">[W]</span>
            </div>

            <div class="method-description">
              <p>Sets metadata, mainly used for <code>Result.from</code>.</p>
              </div>
            </div>
          <div id="attribute-i-time" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">time</span><span
                class="attribute-access-type">[RW]</span>
            </div>

            <div class="method-description">
              <p>The time it took to run.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-methods_matching" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">methods_matching</span><span
                                class="method-args">(re)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns all instance methods matching the pattern <code>re</code>.</p>

                              <div class="method-source-code" id="methods_matching-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 321</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">methods_matching</span> <span class="ruby-identifier">re</span>
  <span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">true</span>).<span class="ruby-identifier">grep</span>(<span class="ruby-identifier">re</span>).<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:to_s</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-run" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run</span><span
                                class="method-args">(reporter, options = {})</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Responsible for running all runnable methods in a given class, each in its own instance. Each instance is passed to the reporter to record.</p>

                              <div class="method-source-code" id="run-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 336</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">run</span> <span class="ruby-identifier">reporter</span>, <span class="ruby-identifier">options</span> = {}
  <span class="ruby-identifier">filtered_methods</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:filter</span>]
    <span class="ruby-identifier">filter</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:filter</span>]
    <span class="ruby-identifier">filter</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span> <span class="ruby-node">$1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">filter</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r%/(.*)/%</span>

    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">runnable_methods</span>.<span class="ruby-identifier">find_all</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">filter</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">filter</span> <span class="ruby-operator">===</span> <span class="ruby-node">&quot;#{self}##{m}&quot;</span>
    }
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">runnable_methods</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:exclude</span>]
    <span class="ruby-identifier">exclude</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:exclude</span>]
    <span class="ruby-identifier">exclude</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span> <span class="ruby-node">$1</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exclude</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r%/(.*)/%</span>

    <span class="ruby-identifier">filtered_methods</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">exclude</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">m</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">exclude</span> <span class="ruby-operator">===</span> <span class="ruby-node">&quot;#{self}##{m}&quot;</span>
    }
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">filtered_methods</span>.<span class="ruby-identifier">empty?</span>

  <span class="ruby-identifier">with_info_handler</span> <span class="ruby-identifier">reporter</span> <span class="ruby-keyword">do</span>
    <span class="ruby-identifier">filtered_methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_name</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">run_one_method</span> <span class="ruby-keyword">self</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">reporter</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-run_one_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run_one_method</span><span
                                class="method-args">(klass, method_name, reporter)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs a single method and has the reporter record the result. This was considered internal API but is factored out of run so that subclasses can specialize the running of an individual test. See Minitest::ParallelTest::ClassMethods for an example.</p>

                              <div class="method-source-code" id="run_one_method-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 372</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">run_one_method</span> <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">reporter</span>
  <span class="ruby-identifier">reporter</span>.<span class="ruby-identifier">prerecord</span> <span class="ruby-identifier">klass</span>, <span class="ruby-identifier">method_name</span>
  <span class="ruby-identifier">reporter</span>.<span class="ruby-identifier">record</span> <span class="ruby-constant">Minitest</span>.<span class="ruby-identifier">run_one_method</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">method_name</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-runnable_methods" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">runnable_methods</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Each subclass of Runnable is responsible for overriding this method to return all runnable methods. See methods_matching.</p>

                              <div class="method-source-code" id="runnable_methods-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 417</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">runnable_methods</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;subclass responsibility&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-runnables" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">runnables</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns all subclasses of Runnable.</p>

                              <div class="method-source-code" id="runnables-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 424</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">runnables</span>
  <span class="ruby-identifier">@@runnables</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-test_order" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">test_order</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Defines the order to run tests (:random by default). Override this or use a convenience method to change it for your tests.</p>

                              <div class="method-source-code" id="test_order-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 381</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">test_order</span>
  <span class="ruby-value">:random</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-metadata" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">metadata</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Metadata you attach to the test results that get sent to the reporter.</p>

<p>Lazily initializes to a hash, to keep memory down.</p>

<p>NOTE: this data <strong>must</strong> be plain (read: marshal-able) data! Hashes! Arrays! Strings!</p>

                              <div class="method-source-code" id="metadata-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 463</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">metadata</span>
  <span class="ruby-ivar">@metadata</span> <span class="ruby-operator">||=</span> {}
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-metadata-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">metadata?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns true if metadata exists.</p>

                              <div class="method-source-code" id="metadata-3F-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 475</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">metadata?</span>
  <span class="ruby-keyword">defined?</span> <span class="ruby-ivar">@metadata</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-name" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">name</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Name of the run.</p>

                              <div class="method-source-code" id="name-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 307</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name</span>
  <span class="ruby-ivar">@NAME</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-name-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">name=</span><span
                                class="method-args">(o)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the name of the run.</p>

                              <div class="method-source-code" id="name-3D-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 314</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">name=</span> <span class="ruby-identifier">o</span>
  <span class="ruby-ivar">@NAME</span> = <span class="ruby-identifier">o</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-passed-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">passed?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Did this run pass?</p>

<p>Note: skipped runs are not considered passing, but they don’t cause the process to exit non-zero.</p>

                              <div class="method-source-code" id="passed-3F-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 492</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">passed?</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;subclass responsibility&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-result_code" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">result_code</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns a single character string to print based on the result of the run. One of <code>&quot;.&quot;</code>, <code>&quot;F&quot;</code>, <code>&quot;E&quot;</code> or <code>&quot;S&quot;</code>.</p>

                              <div class="method-source-code" id="result_code-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 501</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">result_code</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;subclass responsibility&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-run" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Runs a single method. Needs to return self.</p>

                              <div class="method-source-code" id="run-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 482</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;subclass responsibility&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-skipped-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">skipped?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Was this run skipped? See <a href="Runnable.html#method-i-passed-3F"><code>passed?</code></a> for more information.</p>

                              <div class="method-source-code" id="skipped-3F-source">
            <pre><span class="ruby-comment"># File minitest-5.20.0/lib/minitest.rb, line 508</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">skipped?</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;subclass responsibility&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>. </p><p><a href="https://jamesbritt.bandcamp.com/">Hack your world.  Feed your head.  Live curious</a>.</p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

